package com.hl.qzzpbackend.model.enums;
import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 学校级别枚举
 * @author helong
 */
@Getter
public enum SchoolRankEnum {
    TRIPLET(0, "三本"),
    TWO_EDITIONS(1, "二本"),
    KEY_UNIVERSITIES(2, "一本"),
    DOUBLE_FIRST_CLASS(3, "双一流"),
    TWO_HUNDRED_AND_ELEVEN(4,"211"),
    NINE_HUNDRED_AND_EIGHTY_FIVE(5,"985"),
    OTHER(6, "其他");

    private final Integer value;
    private final String text;

    // 构造函数
    SchoolRankEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static SchoolRankEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (SchoolRankEnum companyTypeEnum : SchoolRankEnum.values()) {
            if (companyTypeEnum.getValue().equals(value)) {
                return companyTypeEnum;
            }
        }
        return null;
    }
}